package org.zero.mapper;

/**
 * @author Zero (cnzeropro@qq.com)
 * @date 2021/10/26 11:47
 */
public interface BaseMapper<PK, Model> {
    /**
     * delete by primary key
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(PK id);

    /**
     * insert record to table
     * @param record the record
     * @return insert count
     */
    int insert(Model record);

    /**
     * insert record to table selective
     * @param record the record
     * @return insert count
     */
    int insertSelective(Model record);

    /**
     * select by primary key
     * @param id primary key
     * @return object by primary key
     */
    Model selectByPrimaryKey(PK id);

    /**
     * update record selective
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(Model record);

    /**
     * update record
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(Model record);
}
